package cn.edu.sjtu.stap.cg;

import org.aspectj.org.eclipse.jdt.internal.compiler.ast.ASTNode;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.MethodBinding;

public class CgBinaryMethod extends CgMethod {
    private static final long serialVersionUID = 1L;

    private MethodBinding methodBinding;

    public CgBinaryMethod() {
        super();
    }

    /**
     * @deprecated A binary method has no corresponding ASTNode.
     */
    public void setASTNode(ASTNode node) {
        // Will not use this method.
    }

    public void setBinaryMethod(MethodBinding m) {
        this.methodBinding = m;
    }

    public String getMethodName() {
        if (null == methodBinding) {
            return null;
        }
        StringBuffer b = new StringBuffer();
        
        b.append(methodBinding.declaringClass.fPackage.shortReadableName());
        b.append('.');
        b.append(methodBinding.declaringClass.shortReadableName());
        b.append(':');
        b.append(methodBinding);
        
        return b.toString();
    }
}
